package com.example.higo.persenter.maishou;

import com.example.higo.api.service.BaseSubscriber;
import com.example.higo.api.service.ExceptionHandle;
import com.example.higo.model.ModelFactory;
import com.example.higo.model.entity.maishou.MaishouBody;
import com.example.higo.model.entity.maishou.MaishouTab;
import com.example.higo.persenter.BasePersenter;
import com.example.higo.view.imp.maishou.MaishouView;

import java.util.Map;

/**
 * Created by wj on 2016/11/9.
 */

public class MaishouPersenter implements BasePersenter {
    @Override
    public void start() {
    }

    private MaishouView maishouView;

    public MaishouPersenter(MaishouView maishouView) {
        this.maishouView = maishouView;
    }


    public void getMaishouTabData() {
        ModelFactory.getIMaishouModel().getMaishouTabModel(new BaseSubscriber<MaishouTab>() {
            @Override
            public void onSuccess(MaishouTab maishouTab) {
                maishouView.onSuccessTab(maishouTab);
            }

            @Override
            public void onFinish() {
                maishouView.onFinish();
            }

            @Override
            public void onFail(ExceptionHandle.ResponeThrowable e) {
                maishouView.onFail(e);
            }
        });
    }

    public void getMaishouBodyData(Map<String,String> map) {
        ModelFactory.getIMaishouModel().getMaishouBodyModel(new BaseSubscriber<MaishouBody>() {
            @Override
            public void onSuccess(MaishouBody maishouBody) {
                maishouView.onSuccessBody(maishouBody);
            }

            @Override
            public void onFinish() {
                maishouView.onFinish();
            }

            @Override
            public void onFail(ExceptionHandle.ResponeThrowable e) {
                maishouView.onFail(e);
            }
        },map);
    }
}
